import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Solution1002 {
    public List<String> commonChars(String[] words) {
        int[] f=new int[26];
        Arrays.fill(f,Integer.MAX_VALUE);
        for (String word : words) {
            int[] g=new int[26];
            for (char c : word.toCharArray()) {
                g[c-'a']++;
            }
            for (int i = 0; i < 26; i++) {
                f[i]=Math.min(f[i],g[i]);
            }
        }
        List<String> list=new ArrayList<>();
        for (int i = 0; i < 26; i++) {
            for (int i1 = 0; i1 < f[i]; i1++) {
                list.add(String.valueOf((char)(i+'a')));
            }
        }
        return list;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1002().commonChars(new String[]{"bella","label","roller"}));
    }
}
